
#include"SList.h"

void test1()
{
	SListNode* plist = NULL;

	for(int i =1;i<=10;i++)
		SLPushFront(&plist, i);

	SLPrint(&plist);
}
void test2()
{
	SListNode* plist = NULL;

	for (int i = 1; i <= 10; i++)
		SLPushBack(&plist, i);

	SLPrint(&plist);
}
void test3()
{
	SListNode* plist = NULL;

	for (int i = 1; i <= 5; i++)
		SLPushBack(&plist, i);
	SLPrint(&plist);

	SLPopBack(&plist);
	SLPrint(&plist);
	SLPopBack(&plist);
	SLPrint(&plist);
	SLPopBack(&plist);
	SLPrint(&plist);
	SLPopBack(&plist);
	SLPrint(&plist);;
	SLPopBack(&plist);
	SLPrint(&plist);
	SLPopBack(&plist);
	SLPrint(&plist);

	for (int i = 1; i <= 5; i++)
		SLPushBack(&plist, i);
	SLPrint(&plist);

}
void test4()
{
	SListNode* plist = NULL;

	for (int i = 1; i <= 5; i++)
		SLPushBack(&plist, i);
	SLPrint(&plist);

	SListNode* pos = SListFind(plist, 3);
	pos->data = 30;
	SLPrint(&plist);

}
void test5()
{
	SListNode* plist = NULL;

	for (int i = 1; i <= 5; i++)
		SLPushBack(&plist, i);
	SLPrint(&plist);

	SListNode* hand = SListFind(plist, 1);

	SLInsert(&plist, hand, 0);
	SLPrint(&plist);

	SListNode* hand2 = SListFind(plist, 0);
	SLInsert(&plist, hand2, -1);
	SLPrint(&plist);
}
void test6()
{
	SListNode* plist = NULL;

	for (int i = 1; i <= 5; i++)
		SLPushBack(&plist, i);
	SLPrint(&plist);

	SListNode* hand = SListFind(plist, 1);
	SLErase(&plist, hand);
	SLPrint(&plist);

	SListNode* hand2 = SListFind(plist, 5);
	SLErase(&plist, hand2);
	SLPrint(&plist);

	SListNode* hand3 = SListFind(plist, 3);
	SLErase(&plist, hand3);
	SLPrint(&plist);

	SLDestroy(&plist);
}
int main()
{
	test6();

	return 0;
}